/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sistemperpustakaan.tablemodel;

import java.util.ArrayList;
import java.util.List;
import javax.swing.table.AbstractTableModel;
import sistemperpustakaan.entity.ViewInventaris;

/**
 *
 * @author EKo
 */
public class InventarisTableModel extends AbstractTableModel {
List<ViewInventaris> listInventaris;
    String[] header = {"ID Inventaris", "ID Buku", "No Panggil", "ISBN","Judul", "Pengarang", "Penerbit",  "Status"};

    public InventarisTableModel() {
        listInventaris = new ArrayList<ViewInventaris>();
    }

    public void rowDataInserted(ViewInventaris lI) {
        listInventaris.add(lI);
        fireTableRowsInserted(getRowCount() - 1, getRowCount() - 1);
    }

    public void setListInventaris(List<ViewInventaris> listInventaris) {
        this.listInventaris = listInventaris;
    }
    public int getRowCount() {
        return listInventaris.size();
    }

    public int getColumnCount() {
        return 8;
    }

    public Object getValueAt(int rowIndex, int columnIndex) {
        return listInventaris.get(rowIndex).getObject(columnIndex);
    }
    @Override
    public String getColumnName(int column) {
        return header[column];
    }

}
